import { createStore } from 'vuex'
import { getMoviesApi } from '../untils/api.js'
export default createStore({
  state: {
    count: 1,
    list: [],
  },
  mutations: {
    GETLIST(state, res) {
      state.list = res
    }

  },
  actions: {
    async getList({ commit }) {
      const res = await getMoviesApi()
      const action = {
        type: 'GETLIST',
        res: res
      }
      commit(action)
    }
  },

})
